﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using iLangl.Model;
using iLangl.BusinessModel.DAL;

namespace iLangl.BusinessModel.Managers
{
	public class ContactManager
	{
		#region Singelton Pattern
		private ContactManager()
		{
		}

		private static ContactManager instance;
		private static object mutex = new object();
		/// <summary>
		/// The instance of the ContactManager.
		/// </summary>
		public static ContactManager Instance
		{
			get
			{
				if (instance == null)
				{
					lock (mutex)
					{
						if (instance == null)
						{
							instance = new ContactManager();
						}
					}
				}
				return instance;
			}
		}
		#endregion

		public Contact GetContact(String contactId)
		{
			return DALFacade.Instance.ContactDAL.ReadContact(contactId);
		}

		public void FillContact(Contact contact)
		{
			throw new NotImplementedException();
		}

		public void UpdateContact(Contact contact)
		{
			DALFacade.Instance.ContactDAL.UpdateContact(contact, null);
		}

		public void CreateContact(Contact contact)
		{
			DALFacade.Instance.ContactDAL.CreateContact(contact, null);
		}

	}
}
